home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 February / Gamestar_81_2006-02_dvd.iso / Red Shark / Missions / Mission_8 / Mission.script < prev    next >
Text File  |  2001-12-19  |  5KB  |  210 lines

  1. //---------------------------------
  2. //  Mission script
  3. //
  4. //  (c) 2001 G5 Software:
  5. //      Sergey Shoolts
  6. //      Vlad Suglobov
  7. //      Max Ryumin
  8. //      Alex Tabunov
  9. //      Alex Koloskov
  10. //---------------------------------
  11.  
  12. class CInterceptJeepMission extends
  13.         CBaseMission,
  14.         CNavPointUser,
  15.         CInterceptJeepMissionObjectList,
  16.         CInterceptJeepMission_Strings
  17. {
  18.   int GetAutoGeneratedUnitsQty()
  19.   {
  20.     return 6;
  21.   }
  22.  
  23.   void CInterceptJeepMission()
  24.   {
  25.     BaseMission_InitMission();
  26.  
  27.     BaseMission_UpdateLoadProgress();
  28.     CreateComponent("DebugCamera", "GameObject", "CDebugCamera");
  29.     SetComponentPosition("DebugCamera",
  30.       matrix(
  31.         1.0, 0.0, 0.0, 8000.0,
  32.         0.0, 1.0, 0.0, 8000.0,
  33.         0.0, 0.0, 1.0,  600.0,
  34.         0.0, 0.0, 0.0,    1.0
  35.       ));
  36.  
  37.     // CreateComponent(IDToRegister, ComponentID, ScriptName | FileName | "")
  38.     BaseMission_UpdateLoadProgress();
  39.     CreateComponent("Atmosphere", "Atmosphere", "CInterceptJeepMission_Atmosphere");
  40.  
  41.     BaseMission_UpdateLoadProgress();
  42.     CreateComponent("Sky", "SkyObject", "CInterceptJeepMission_Sky");
  43.  
  44.     BaseMission_UpdateLoadProgress();
  45.     CreateComponent("Terrain", "ProgressiveTerrainObject", "CInterceptJeepMission_Terrain");
  46.  
  47.     BaseMission_UpdateLoadProgress();
  48.     CreateComponent("Forest", "Forest", "CInterceptJeepMission_Forest");
  49.  
  50.     BaseMission_UpdateLoadProgress();
  51.     CreateComponent( "AIController", "AIController", "CMission8_AIController");
  52.  
  53.     BaseMission_CreateObjects();
  54.   }
  55.  
  56.   array m_MissionObjectivesStatuses =
  57.           array(
  58.             str_ObjectiveInProgress,
  59.             str_ObjectiveInProgress
  60.           );
  61.  
  62.   array m_BonusMissionObjectivesStatuses =
  63.           array(
  64.             str_ObjectiveInProgress
  65.                   );
  66.  
  67.   //
  68.   //  'virtual' methods
  69.   //
  70.  
  71.   //
  72.   //  Mission statistics
  73.  
  74.   string GetMissionStatistics()
  75.   {
  76.     return "";
  77.   }
  78.  
  79.   //
  80.   //  Mission navpoints
  81.  
  82.   // the 1st navpoint in the array is a default one
  83.   array GetNavPoints()
  84.   {
  85.     array navpoints =
  86.       array(
  87.         GetNavPoint("NavPoint_Camp"),
  88.         GetNavPoint("NavPoint_Galder"),
  89.         GetNavPoint("NavPointFuel")
  90.       );
  91.     return navpoints;
  92.   }
  93.  
  94.   //
  95.   //  Mission map skin file
  96.  
  97.   string GetMapSkinFileName()
  98.   {
  99.     return "Missions/Mission_8/Map.skin";
  100.   }
  101.  
  102.   void OnGalderWon()
  103.   {
  104.     Core_BroadcastEvent(
  105.           "OnDisplayMessage",
  106.           str_GalderWonMessage,
  107.           m_BadNewsColor
  108.          );
  109.     BaseMission_DelayedQuit();
  110.   }
  111.  
  112. //#TMP:
  113.   boolean GalderStarted = false;
  114.   void GalderStart()
  115.   {
  116.     if ( !GalderStarted )
  117.     {
  118.       Core_BroadcastEvent(
  119.         "OnDisplayMessage",
  120.         str_GalderStartedMessage,
  121.         m_BadNewsColor
  122.       );
  123.       Core_SendEventTo(
  124.         "Helicopter",
  125.         "ShowEventObject",
  126.         "8_Galder_A_02",          //     - id of object to show
  127.         80.0                      //     - distance from camera to object
  128.         );
  129.       GalderStarted = true;
  130.     }
  131.   }
  132.   boolean CampAlarmed = false;
  133.   void CampAlarm()
  134.   {
  135.     if ( !CampAlarmed )
  136.     {
  137.       Core_BroadcastEvent(
  138.         "OnDisplayMessage",
  139.         str_CampAlarmMessage,
  140.         m_BadNewsColor
  141.       );
  142.       CampAlarmed = true;
  143.     }
  144.   }
  145.  
  146.   void WarningDetected()
  147.   {
  148.     if ( !GalderStarted )
  149.     {
  150.       Core_BroadcastEvent(
  151.         "OnDisplayMessage",
  152.         str_WarningMessage,
  153.         m_BadNewsColor);
  154.     }
  155.   }
  156.  
  157.   final int GalderKilledToWin = 3;
  158.   final int NaziCampToWin = 15;
  159.   final int NaziFuelToWin = 4;
  160.   int m_GalderKilled = 0;
  161.   int m_NaziCampKilled = 0;
  162.   int m_NaziFuelKilled = 0;
  163.   bool GalderKilled = false;
  164.   bool CampKilled = false;
  165.   color StructureDestroyedColor = color(1.0, 0.0, 0.0);
  166.  
  167.   void OnGameObjectDestroyed(string _id)
  168.   {
  169.     BaseMission_OnGameObjectDestroyed(_id);
  170.  
  171.     Core_BroadcastEvent( "Unit_Destroyed", _id);
  172.  
  173.     if ( Core_IsStringStartsWith( _id, "8_Galder_A") )
  174.     {
  175.       m_GalderKilled = m_GalderKilled + 1;
  176.       if ( m_GalderKilled >= GalderKilledToWin )
  177.       {
  178.         BaseMission_CompleteObjective(0);
  179.         GalderKilled = true;
  180.       }
  181.     }
  182.     if ( Core_IsStringStartsWith( _id, "8_NaziCamp") )
  183.     {
  184.       m_NaziCampKilled = m_NaziCampKilled + 1;
  185.       if ( m_NaziCampKilled >= NaziCampToWin )
  186.       {
  187.         BaseMission_CompleteObjective(1);
  188.         CampKilled = true;
  189.       }
  190.     }
  191.     if ( Core_IsStringStartsWith( _id, "8_NaziFuel_B") )
  192.     {
  193.       m_NaziFuelKilled = m_NaziFuelKilled + 1;
  194.       if ( m_NaziFuelKilled >= NaziFuelToWin )
  195.       {
  196.         BaseMission_CompleteBonusObjective(0);
  197.       }
  198.     }
  199.  
  200.   }
  201.  
  202.   void OnMissionLoaded()
  203.   {
  204.     Core_SendEventTo("Helicopter", "OnInitiallyEnableTargetScreen", false);
  205.  
  206.     // Start mission music playing
  207.     Core_SendEventTo(SOID_MusicController, "PlayMissionMusic", 8);
  208.   }
  209. }
  210.